
#ifndef HUFFMANIMAGECOMPRESSION_IMAGE_H
#define HUFFMANIMAGECOMPRESSION_IMAGE_H

class Image {
    unsigned char* imageInfo;
    unsigned char* data;
    uint32_t width;
    uint32_t height;
    uint32_t rawDataSize;
    uint32_t dataSize;
public:
    Image(unsigned char* , unsigned char* , uint32_t , uint32_t , uint32_t, uint32_t);
    ~Image();

    uint32_t getRawDataSize();
    uint32_t getHeight();
    uint32_t getWidth();
    uint32_t getDataSize();
    unsigned char* getData();
    unsigned char* getImageInfo();
};


//Image IO Exception
#include <stdexcept>
#include <string>
using namespace std;

class ImageIOException: public runtime_error {
public:
    explicit ImageIOException(const string &__arg);
};



//Image IO Helper

#include <string>
#include "image.h"
#include "util_file.h"
#include <unordered_map>
using namespace std;

class ImageIOHelper {
public:
    static const uint32_t BitmapInfoLength;

    static const uint32_t BitmapWidthOffset;
    static const uint32_t BitmapHeightOffset;
    static const uint32_t BitmapSizeOffset;

    static const uint32_t BitmapPixelBitSizeOffset;
    static const uint32_t BitmapTrueColorBitSize;
    static uint32_t BitmapTrueColorChannelCount;

    static const uint32_t EncodeFileInfoLength;

    static Image* readImage(const string&);
    static Image* fromArray(const string&);

    static EncodeFile* readEncodeFile(const string&);
    static void writeEncodeFile(const string& ,
                           const unsigned char* ,
                           const unordered_map<unsigned char, uint32_t> ,
                           const unsigned char* ,
                           uint32_t, uint32_t);
    static void writeImage(const string &,
                           unsigned char* ,
                           const unsigned char*);
};


#endif //HUFFMANIMAGECOMPRESSION_IMAGE_H
